<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>首页</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=no"/>
    <link rel="stylesheet" href="/resource/common/layui/css/layui.css" media="all"/>
</head>
<body>


<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div id="main" style="width: 100%;height:450px;"></div>
                </div>
            </div>
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div id="main1" style="width: 100%;height:450px;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/resource/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/resource/common/layui/layui.js"></script>
<script type="text/javascript" src="/resource/js/echarts.min.js"></script>
<script type="text/javascript" th:inline="javascript">
    var nameList = [[${nameList}]]
    var numberList = [[${numberList}]]
    var timeList = [[${timeList}]]
    timeList.sort((a,b)=>{
        return new Date(a)-new Date(b)
    })

    console.log(timeList)
    var orderNumberList = [[${orderNumberList}]]
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    var myChart1 = echarts.init(document.getElementById('main1'));
    // 指定图表的配置项和数据
    var option = {
        title: {
            text: '商品销量统计'
        },
        tooltip: {},
        legend: {
            data: ['销量']
        },
        xAxis: {
            data: nameList
            , axisLabel: {
                interval: 0,
                rotate: -45,//倾斜度 -90 至 90 默认为0
                margin: 2,
                textStyle: {
                    fontWeight: "bolder",
                    color: "#000000"
                }
            }
        },
        yAxis: {},
        series: [{
            name: '销量',
            type: 'bar',
            data: numberList
        }]
    };
    option1 = {
        title: {
            text: '月订单额度统计'
        },
        xAxis: {
            type: 'category',
            data: timeList
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: orderNumberList,
            type: 'line'
        }]
    };

    myChart.setOption(option);
    myChart1.setOption(option1);
</script>
</body>
</html>

